var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  let sort = req.param("sort");
  let page = req.param("page");
  let pageSize = req.param("pageSize");
  let skip = (page-1)*pageSize;
  let params = {};
  let goodModel = Goods.find(params).skip(slip).limit(pageSize);    //跳过多少条数据
  goodModel.sort({ 'salePrice': sort});
  goodModel.exec({},function (err,doc) {
    if (err) {
      res.json({
        status:"1",
        msg:err.message
      });
    }else{
      res.json({
        status:'0',
        msg:'',
        result:{

        }
      })
    }
  })
  Goods.find({},function name(err,doc) {
   
  })

  res.render('index', { title: 'Express,zhongmy' });
});

module.exports = router;
